<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        let email=window.prompt("请输入正确的邮箱地址：");
        let index1=email.indexOf("@");
        let index2=email.indexOf(".");

        if (index1==-1){
            alert("格式不正确，没有@");
        }
        if (index2==-1){
            alert("格式不正确，没有.");
        }
        if (index1>index2){
            alert("格式不正确，@不应该在.前面");
        }else{
            alert("您输入的邮箱合法");
        }

    </script>

</body>
</html>

